import Vue from 'vue'
import App from './App.vue'
import router from "./router";
import store from './store' //引入Vue x配置
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import './access/font-awesome.min.css';
import fun from './common.js'
import Axios from 'axios'
import 'default-passive-events';

// import fontawesome from '@fortawesome/fontawesome'
// import FontAwesomeIcon from '@fortawesome/vue-fontawesome'
// import solid from '@fortawesome/fontawesome-free-solid'
// import regular from '@fortawesome/fontawesome-free-regular'
// import brands from '@fortawesome/fontawesome-free-brands'

// fontawesome.library.add(solid)
// fontawesome.library.add(regular)
// fontawesome.library.add(brands)

// Vue.component('font-awesome-icon', FontAwesomeIcon)








import Qs from "qs";
Vue.prototype.Qs = Qs;
// Vue.component('font-awesome-icon', FontAwesomeIcon);
// Vue.use(library)
Vue.config.productionTip = false;
Vue.prototype.$pubFuc = fun
Vue.use(ElementUI);
Vue.prototype.$axios = Axios
Vue.prototype.$store = store
Vue.prototype.$http = Axios
const BASE_URL = "/api";
Axios.defaults.baseURL = '/api'
Axios.defaults.headers.post['Content-Type'] = 'application/json';
Vue.config.productionTip = false
export const GET = (url, param) => {
	return Axios.get(`${BASE_URL}${url}`, param).then(res => res.data);
};

export const POST = (url, param) => {
	return Axios.get(`${BASE_URL}${url}`, param).then(res => res.data);
};

const cors = {	//跨域设置
	origin: 'http://localhost:3000',
	credentials: true,
	maxAge: '1',
	methods: 'GET,POST,PUT,DELETE,OPTIONS',
	allowedHeaders: 'Content-Type, Authorization, X-Requested-With',
	exposedHeaders: 'X-Pagination-Total-Count,X-Pagination-Page-Count,X-Pagination-Current-Page,X-Pagination-Per-Page,X-Pagination-Sort-Field,X-Pagination-Sort-Direction',
	preflightContinue: false,
	optionsSuccessStatus: 200,

}
Vue.use(cors); //使用cors中间件




new Vue({
	router,
	store,
	render: h => h(App)
}).$mount('#app')

